package com.xm_jd.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xm_jd.utils.BaseServlet;

/**
 * Servlet implementation class YanZen
 */
@WebServlet("/YanZen")
public class YanZen extends BaseServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public YanZen() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		//判读验证码
		String icode = request.getParameter("yz");
		//获得手机
		String piccode = (String) request.getSession().getAttribute("piccode");
		if(icode!=null){
		
		if(!icode.equals("")){
			if(!icode.equals(piccode)){
				response.getWriter().println(1);
			}else{
				response.getWriter().println(2);
			}
			}else{
				response.getWriter().println("您输入的验证码为空");
			}
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
